/*
 * @Author:     
 * @Date: 2022-12-05 17:02:59
 * @LastEditors:     
 * @LastEditTime: 2023-09-08 17:32:31
 * @FilePath: /yqh-wm/public/base/utils/reg.js
 * @Description:
 *
 * Copyright (c) 2022 by     , All Rights Reserved.
 */

const phoneReg = {
  // 自定义校验规则
  validator: (value) => {
    return /^(1[0-9])\d{9}$/.test(value);
  },
  message: '请输入正确格式的手机号码',
  trigger: 'onBlur',
};
const mailReg = {
  // 自定义校验规则
  validator: (value) => {
    return /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value);
  },
  message: '请输入正确格式的邮箱',
  trigger: 'onBlur',
};

const zhReg = {
    // 自定义校验规则
    validator: value => {
        return /^[\u2E80-\u9FFF]+$/
            .test(value)
    },
    message: '请输入中文',
    trigger: 'onBlur'
}
const enReg = {
    // 自定义校验规则
    validator: value => {
        return /^[a-zA-Z0-9_\s]+$/
            .test(value)
    },
    message: '请输入字母.数字',
    trigger: 'onBlur'
}

const fourNumReg = {
    // 自定义校验规则
    validator: value => {
        return /^\d{4}$/
            .test(value)
    },
    message: '请输入手机后4位/Wrong format',
    trigger: 'onBlur'
}
const fourfiveNumReg = {
  // 自定义校验规则
  validator: value => {
    return /^\d{4,5}$/.test(value)
  },
  message: '请输入手机后4-5位数字',
  trigger: 'onBlur'
}
const idCardReg = {
  // 自定义校验规则
  validator: value => {
      return /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
          .test(value)
  },
  message: '请输入正确的身份证号',
  trigger: 'onBlur'
}
